#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEngine;

public sealed class FantasyToolBar : Editor
{
    [MenuItem("SrcFramework/Fantasy/导表")]
    public static void GenerateFantasyConfigTable()
    {
        string startPath = Directory.GetCurrentDirectory() + "\\Tools\\ConsoleApp1\\Tools\\Exporter\\ConfigTable";
        string fileName = "Run.bat";

        var startInfo = new System.Diagnostics.ProcessStartInfo();
        startInfo.FileName = fileName;
        startInfo.WorkingDirectory = startPath;

        if (!File.Exists(startPath + "\\" + fileName))
        {
            Debug.LogError($"请检查{startPath + "\\" + fileName}文件是否存在，路径是否正确!");
            return;
        }
        System.Diagnostics.Process.Start(startInfo);
    }

    [MenuItem("SrcFramework/Fantasy/导出协议")]
    public static void GenerateFantasyNetworkProtocol()
    {
        string startPath = Directory.GetCurrentDirectory() + "\\Tools\\ConsoleApp1\\Tools\\Exporter\\NetworkProtocol";
        string fileName = "Run.bat";

        var startInfo = new System.Diagnostics.ProcessStartInfo();
        startInfo.FileName = fileName;
        startInfo.WorkingDirectory = startPath;

        if (!File.Exists(startPath + "\\" + fileName))
        {
            Debug.LogError($"请检查{startPath + "\\" + fileName}文件是否存在，路径是否正确!");
            return;
        }
        System.Diagnostics.Process.Start(startInfo);
    }
}
#endif
